package mb.view;

import java.awt.Container;
import java.awt.event.WindowListener;  // +
import java.awt.event.WindowEvent;  // +
import javax.swing.JFrame;
import mb.model.Diagram;

public class AppFrame extends JFrame implements WindowListener {  // &

  private Diagram diagram = new Diagram();

  public AppFrame() {
    super();
    this.addWindowListener(this);  // +
    this.setTitle("Yellow or red box");  // &
    this.setSize(400, 300);
    Container cp = this.getContentPane();
    cp.add(diagram);
  }

  // {+}

  public void exit() {
    this.dispose();
    System.exit(0);
  }

  public void windowOpened(WindowEvent e) {
  
  }

  public void windowClosing(WindowEvent e) {
    this.exit(); 
  }
  
  public void windowClosed(WindowEvent e) {
  
  }

  public void windowIconified(WindowEvent e) {

  } 

  public void windowDeiconified(WindowEvent e) {  
  
  }

  public void windowActivated(WindowEvent e) {  
  
  }  

  public void windowDeactivated(WindowEvent e) {

  }

}

